#ifndef PLOT_REALTIME_H
#define PLOT_REALTIME_H

#define _USE_MATH_DEFINES
#include <stdio.h>  
#include <iostream>
#include <cmath>
#include <pthread.h>
#include <unistd.h>
#include <time.h>
#include "matplotlibcpp.h"

using namespace std;
namespace plt = matplotlibcpp;

class plot_realtime
{
public:	
	//构造和析构函数	
	plot_realtime();
	~plot_realtime(); 

	//public members here;
	//including variables and functions you want to call in scripts;
	
	vector<double> *x;
	vector<double> *y;
	vector<double> *x1;
	vector<double> *y1;
	double * x_value;
	double * y_value;
	double * x1_value;
	double * y1_value;
	vector<double> x_vector;
	vector<double> y_vector;
	vector<double> x1_vector;
	vector<double> y1_vector;
	pthread_t pth;
	bool bExit = false;
	
	static void * plot_loop_pth(void * arg);
	static void * plot_novector_loop_pth(void * arg);
	void plot(vector<double>& value);
	void plot(double& value);
	
	static void * plot_loop_pth_two_para(void * arg);
	void plot(vector<double>& time, vector<double>& value);
	
	static void * plot_loop_pth_two_plot(void * arg);
	static void * plot_novector_loop_pth_two_plot(void * arg);
	void double_plot(vector<double>& value1, vector<double>& value2);
	void double_plot(double& value1, double& value2);
	
	static void * plot_loop_pth_two_plot_two_para(void * arg);
	void double_plot(vector<double>& time1, vector<double>& value1, vector<double>& time2, vector<double>& value2);
	
	void exit();
	
protected:
	//protected members here;
	//normally, most of variables and inside functions are here;

private:
	//private members here;
};

#endif
